<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
  function foo(name){
    this.name=name
  }
  foo.prototype.sayName=function(){
    console.log(this.name)
  }
  var foo1=new foo('foo1')
    var foo2=new foo('foo2')

    var sayName=foo1.sayName
    sayName();
    sayName=sayName.bind(foo1)
    sayName()

    sayName=sayName.bind(foo2)
    sayName()
  </script>

</body>
</html>
